import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Detail from '@/components/Detail.vue'
import Next from '@/components/Next.vue'
import Douban from '@/components/douban/Douban.vue'
import NFT from '@/components/binnance/NFT.vue'
const routes = [
  {
    path: '/',
    name: 'home',
    component: NFT
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    // 按需引入，没有访问就不会引入和加载这个组件
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/detail',
    name: 'Detail',
    component: Detail
  }, {
    path: '/next',
    name: 'Next',
    component: Next
  },
  {
    path: '/douban',
    name: 'Douban',
    component: Douban
  }, {
    path: '/next',
    name: 'Next',
    component: Next
  }, {
    path: '/nft',
    name: 'NFT',
    component: NFT
  }
]

const router = createRouter({
  // createWebHashHistory hash模式路由，都需要添加一个 # 进行访问。比如 localhost:8080/about 
  // 需要 localhost:8080#/about
  // history: createWebHashHistory(process.env.BASE_URL),
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
